import { createRouter, createWebHistory } from 'vue-router'
import staticRoutes from './staticRoutes'

import createRouteGuard from './guard'

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/app-manage',
      meta: { title: 'empty', isHidden: true },
    },
    ...staticRoutes,
    {
      path: '/:pathMatch(.*)*',
      component: () => import(/* webpackChunkName: "404" */ '@/views/404/index.vue'),
      meta: { title: '404 Not Found', isHidden: true },
    },
  ],
})

// 注册全局路由守卫
createRouteGuard(router)

export default router
